package com.mdd.common.entity.zdjd.param;

import com.mdd.common.entity.zdjd.TZdjdDeviceData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

@Data
@ApiModel("设备回传参数模块入参")
public class DeviceDataParam implements Serializable {

    @ApiModelProperty(value = "设备id")
    private String Id;

    @ApiModelProperty(value = "设备编码")
    private String model;

    @ApiModelProperty(value = "点火温度")
    private Integer pHS;

    @ApiModelProperty(value = "工作温度")
    private Integer pHr;

    @ApiModelProperty(value = "调整温度")
    private Integer pHd;

    @ApiModelProperty(value = "起始档位")
    private Integer PGo;

    @ApiModelProperty(value = "点火强度")
    private Integer pis;

    @ApiModelProperty(value = "加热保持时间")
    private Integer pHt;

    @ApiModelProperty(value = "加热保持温度")
    private Integer PHP;

    @ApiModelProperty(value = "开机加热保持")
    private Integer pSt;

    @ApiModelProperty(value = "报警设置")
    private Integer pEr;

    @ApiModelProperty(value = "档位0功率")
    private Integer pP0;

    @ApiModelProperty(value = "档位1功率")
    private Integer pP1;

    @ApiModelProperty(value = "档位2功率")
    private Integer pP2;

    @ApiModelProperty(value = "档位3功率")
    private Integer pP3;

    @ApiModelProperty(value = "档位4功率")
    private Integer pP4;

    @ApiModelProperty(value = "档位5功率")
    private Integer pP5;

    @ApiModelProperty(value = "档位6功率")
    private Integer pP6;

    @ApiModelProperty(value = "档位7功率")
    private Integer pP7;

    @ApiModelProperty(value = "档位8功率")
    private Integer pP8;

    @ApiModelProperty(value = "档位9功率")
    private Integer pP9;

    public static TZdjdDeviceData coverToTZdjdDeviceData(DeviceDataParam param,Long deviceId) {
        Date now = new Date();
        Calendar calendar = Calendar.getInstance();
        TZdjdDeviceData deviceData = new TZdjdDeviceData();
        deviceData.setDeviceUuid(param.getId());
        deviceData.setDeviceId(deviceId);
        deviceData.setDeviceCode(param.getModel());
        deviceData.setCreateTime(now);
        deviceData.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
        deviceData.setMonth(String.valueOf(calendar.get(Calendar.MONTH)+1));
        deviceData.setDay(String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)));
        deviceData.setUpdateTime(now);
        deviceData.setPhs(param.getPHS());
        deviceData.setPhr(param.getPHr());
        deviceData.setPhd(param.getPHd());
        deviceData.setPgo(param.getPGo());
        deviceData.setPis(param.getPis());
        deviceData.setPht(param.getPHt());
        deviceData.setPhp(param.getPHP());
        deviceData.setPst(param.getPSt());
        deviceData.setPer(param.getPEr());
        deviceData.setPp0(param.getPP0());
        deviceData.setPp1(param.getPP1());
        deviceData.setPp2(param.getPP2());
        deviceData.setPp3(param.getPP3());
        deviceData.setPp4(param.getPP4());
        deviceData.setPp5(param.getPP5());
        deviceData.setPp6(param.getPP6());
        deviceData.setPp7(param.getPP7());
        deviceData.setPp8(param.getPP8());
        deviceData.setPp9(param.getPP9());
        return deviceData;
    }


}
